﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.IO;
using System.Windows.Forms;

namespace MapControls
{
    public partial class ucMapToolStrip : UserControl
    {
        public ucMapToolStrip()
        {
            InitializeComponent();
            
        }
        private AxMapXLib.AxMap mapControl;
        public void ToolStripSetup(AxMapXLib.AxMap AxMap1)
        {
            mapControl = AxMap1;
            //// Create the ImageList
            ImageList imgList = new ImageList();
            imgList.ImageSize = new Size(18, 16);
            imgList.ColorDepth = ColorDepth.Depth4Bit;
            imgList.TransparentColor = Color.FromArgb(192, 192, 192);

            // adds the bitmap
            if (File.Exists("buttons.bmp"))
            {
                //path = System.IO.Path.GetFullPath("buttons.bmp");
                //bmp = new Bitmap(Assembly.GetExecutingAssembly().GetManifestResourceStream(this.GetType(), "buttons.bmp"));
                Bitmap bmp = new Bitmap("buttons.bmp");
                imgList.Images.AddStrip(bmp);
            }

            toolStripButton1.Image = imgList.Images[15];
            toolStripButton2.Image = imgList.Images[16];
            toolStripButton3.Image = imgList.Images[18];
            toolStripButton4.Image = imgList.Images[9];
        }

        private void toolStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            
        }

        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            mapControl.CurrentTool = MapXLib.ToolConstants.miZoomInTool;
        }

        private void toolStripButton2_Click(object sender, EventArgs e)
        {
            mapControl.CurrentTool = MapXLib.ToolConstants.miZoomOutTool;
        }

        private void toolStripButton3_Click(object sender, EventArgs e)
        {
            mapControl.CurrentTool = MapXLib.ToolConstants.miPanTool;
        }

        private void toolStripButton4_Click(object sender, EventArgs e)
        {
            mapControl.CurrentTool = MapXLib.ToolConstants.miSelectTool;
        }
    }
}
